package com.sk.bilibili.model.fragment.main.shop;

import com.sk.api.annotations.Autowired;
import com.sk.bilibili.bean.Cover;
import com.sk.bilibili.callBack.RequestCallBack;
import com.sk.bilibili.dto.Page;
import com.sk.bilibili.mapper.CoverMapper;
import com.sk.bilibili.mapper.GoodsMapper;
import com.sk.bilibili.model.BaseRefreshModel;
import com.sk.bilibili.utils.RequestUtils;
import com.sk.bilibili.view.fragment.main.home.shop.CoverFragment;
import com.sk.bilibili.view.fragment.main.home.shop.GoodsFragment;

public class CoverModel extends BaseRefreshModel<CoverFragment> {

    @Autowired
    CoverMapper coverMapper;
    private int page=1;

    @Override
    public void loadData() {
        RequestUtils.process(coverMapper.page(page), coverPage -> {
            page++;
            view.loadDataSuccess(coverPage.getRecords());
        });
    }

    @Override
    public void refreshData() {
        page=1;
        RequestUtils.process(coverMapper.page(page), coverPage -> {
            page++;
            view.refreshDataSuccess(coverPage.getRecords());
        });
    }

}